<template>
 <view :class="pageClass" :style="pageStyle" v-if="pageReady">
 <moxi-nav :set="navSet"></moxi-nav>
  <template v-for="(list,key) in modData" >
			  <moxi-index v-if="list.name=='diy_search_tag'" :list="list">
				  <view style="padding: 10px;;">
					  <view style="font-weight: 600;color: #666;font-size: 14px;">
						  <text v-if="list.set.tagType=='hot'">{{list.set.hotName}}</text>
						   <text v-else>{{list.set.historyName}}</text>
					  </view>
				  </view>
				  <view>
					 <template v-if="list.set.tagType=='hot'">
						  <text class="search_tag"  v-for="l in list.set.hotList" @click="tag(l)">{{l}}</text>
					 </template>
					  <template v-else>
						   <text class="search_tag" v-if="search_tag.length" v-for="l in search_tag.slice(0,list.set.num)" @click="tag(l)">{{l.keyword}}</text>
					  </template>
					 
				  </view>
			  </moxi-index>
			  <moxi-index v-else :list="list"></moxi-index>
  </template>
   <moxi-tabbar :set="tabbar" v-if="tabbar.index_id"></moxi-tabbar>
</view>
</template>

<script>
	export default {
		data() {
			return {
				search_tag:[]
			}
		},
		onShow() {
			let data = this.moxiCache('search_tag_list')
			if(data.length){
				this.search_tag = data;
				this.$forceUpdate()
			}
		},
		methods: {
			tag(list){
				if(list.search_type=='goods'){
					this.navto('page_mall/goods/list?column_type='+list.search_type+'&search='+list.keyword)
				}else if(list.search_type=='article'){
					this.navto('pages/index/list?column_type='+list.search_type+'&search='+list.keyword)
				}
			}
		}
	}
</script>

<style>
.search_tag{padding: 4px 8px;background-color: #ccc;display: inline-block;margin: 5px;font-size: 12px;
border-radius: 4px;color: #fff;}
</style>
